package com.nantai.jiafang.nantaijiafang.base;

import android.databinding.DataBindingUtil;
import android.databinding.ViewDataBinding;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.Toast;

/**
 * Created by Administrator on 2017/11/1.
 */

public abstract class BaseActivity<B extends ViewDataBinding>  extends AppCompatActivity {
    private B binding;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        binding= DataBindingUtil.setContentView(this,layoutid());
        init(binding);
    }
    public abstract int layoutid();
    public abstract void init(B binding);
    public void toast(String s){
        Toast.makeText(this, s, Toast.LENGTH_SHORT).show();
    }
    public void toast(int s){
        Toast.makeText(this, String.valueOf(s), Toast.LENGTH_SHORT).show();
    }
    public void toast(float s){
        Toast.makeText(this, String.valueOf(s), Toast.LENGTH_SHORT).show();
    }
}
